package FiveHomeworkDesign.Observer;

import java.util.Observer;

/**
 * @author 北巷_东坡
 * @date 2022/11/21 22:25
 * @computer 10741
 */
public class ConcreteAllay extends Allay206{
    public ConcreteAllay(String name) {
        this.name = name;
    }

    @Override
    public void notifyMembers(String name) {
        System.out.println(this.name + "联盟中成员" + name + "遭受敌人攻击！");
        for (Observer206 observer : membersArrayList) {
            if (!observer.name.equals(name)) // 自己不能帮自己
                observer.help(name);
        }
    }
}
